<?php	if($this->Session->check('Cart.items')){ ?>
<table >
	<tr>
		<th class="cart-img">Hình ảnh</th>
		<th class="cart-name">Sản phẩm</th>
		<th class="cart-price">Đơn giá</th>
		<th class="cart-quantity">Số lượng</th>
		<th class="cart-cost">Thành tiền</th>
		<th></th>
	</tr>
	<?php 
			$items = $this->Session->read('Cart.items');
			$total = 0;
			foreach($items as $i=>$item){ 
				$total+= $item['price'] * $item['quantity'];
	?>
			<tr>
				<td class="cart-img"><?php echo $this->Images->showMedium($item['photo']); ?></td>
				<td class="cart-name"><?php echo $item['name']  ?></td>
				<td class="cart-price"><?php echo $item['price'] ?></td>
				<td class="cart-quantity">
					<?php echo $this->Form->create('Cart', array('url' => '/cart_update/'.$item['id'], 'id' => 'form_'.$item['id'])); ?>
						<input type="text" name="data[Cart][quantity]" value="<?php echo $item['quantity'] ?>" class="num-ipt number-mipt" maxlength=2 />
						<a href="#" class="update-cart" onclick="update_cart(<?php echo $item['id'] ?>, '<?php echo $this->Html->url('/cart_refresh') ?>');">
								<?php echo $this->Html->image('update.png', array('alt' => 'Cập nhật', 'title' => 'Cập nhật')) ?> 
						</a>
					<?php echo $this->Form->end(); ?>						
				</td>
				<td class="cart-cost"><?php echo $item['price'] * $item['quantity'] ?></td>
				<td style="text-align:center;">
					<?php echo $this->Form->create('Cart', array('url' => '/deleteCartItem/'.$item['id'], 'id' => 'form_delete_'.$item['id'])); ?>
						<a href="#" onclick="delete_item_cart(<?php echo $item['id'] ?>, '<?php echo $this->Html->url('/cart_refresh') ?>');"><?php echo $this->Html->image('b-delete.png', array('alt' => 'Xóa SP', 'title' => 'Xóa sản phẩm')) ?> </a>
					<?php echo $this->Form->end(); ?>						
				</td>
			</tr>
	<?php } ?>
	<tr>
		<td colspan=4 class="cart-total">Tổng tiền</td>
		<td class="cart-total"><?php echo $total; ?></td>
		<td></td>
	</tr>
</table>
<div class="action-btn">
	<input type="button" id="buy-continues" onclick="redirect('<?php echo $this->webroot; ?>');" value="<< Tiếp Tục Mua Hàng" class="btn-style" />
	<input type="button" value="Thanh Toán >>" class="btn-style" onclick="redirect('<?php echo $this->Html->url(__('/payment_info')) ?>');" />
</div>
<?php }else{ ?>
		Không có sản phẩm nào trong giỏ hàng
<?php } ?>

